export default {
  // 管理员登录
  'POST /admin/auth/login': (req: any, res: any) => {
    const { username, password } = req.body;

    // 模拟验证逻辑
    if (username === 'admin' && password) {
      res.json({
        code: 200,
        message: 'success',
        data: {
          token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiIsImlhdCI6MTcwNDY3MjAwMCwiZXhwIjoxNzA1Mjc2ODAwfQ.mock_token_signature',
          userInfo: {
            id: 1,
            username: 'admin',
            nickname: '超级管理员',
            email: 'admin@example.com',
            role: 'admin',
            status: 'active',
            avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
          },
        },
        timestamp: Date.now(),
      });
    } else {
      res.status(401).json({
        code: 401,
        message: '用户名或密码错误',
        data: null,
        timestamp: Date.now(),
      });
    }
  },

  // 管理员登出
  'POST /admin/auth/logout': (req: any, res: any) => {
    res.json({
      code: 200,
      message: 'success',
      data: null,
      timestamp: Date.now(),
    });
  },

  // 获取当前管理员信息
  'GET /admin/auth/me': (req: any, res: any) => {
    const authHeader = req.headers.authorization;

    if (authHeader && authHeader.startsWith('Bearer ')) {
      res.json({
        code: 200,
        message: 'success',
        data: {
          id: 1,
          username: 'admin',
          nickname: '超级管理员',
          email: 'admin@example.com',
          phone: '13800138000',
          avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
          gender: 'male',
          birth_date: '1990-01-01',
          role: 'admin',
          status: 'active',
          level: 10,
          experience: 10000,
          total_study_time: 0,
          practice_count: 0,
          points: 1000,
          achievements: ['管理员', '系统维护者'],
          last_login_at: new Date().toISOString(),
          created_at: '2024-01-01T00:00:00.000Z',
          updated_at: new Date().toISOString(),
        },
        timestamp: Date.now(),
      });
    } else {
      res.status(401).json({
        code: 401,
        message: '未授权访问',
        data: null,
        timestamp: Date.now(),
      });
    }
  },
};
